﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Printer
{
    class LocationScan
    {
        private List<string> files = new List<string>();
        private string location;

        public LocationScan(string location)
        {
            this.location = location;
        }

        public List<string> getFiles()
        {

            dirSearch(location);
            return files;
        }

        private void dirSearch(string strDir)
        {
            try
            {
                foreach (string strDirectory in Directory.GetDirectories(strDir))
                {
                    foreach (string strFile in Directory.GetFiles(strDirectory))
                    {
                        files.Add(strFile);
                    }

                    dirSearch(strDirectory);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

    }
}
